home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / CH5 / EMAGA5 BOOK CODE / control / main.cs
Encoding:
Text File  |  2006-07-02  |  1.9 KB  |  55 lines

  1.  
  2. //------------------------------------------------------------------------
  3. // control/main.cs
  4. //  main control module for 3D2E emaga chapter5 sample game
  5. //
  6. //  Copyright (c) 2003, 2006 by Kenneth C.  Finney.
  7. //------------------------------------------------------------------------
  8. //
  9. //-----------------------------------------------------------------------------
  10. // Load up defaults console values.
  11.  
  12. // Pre-determined setting variables
  13. Exec("./client/presets.cs");
  14. Exec("./server/presets.cs");
  15.  
  16.  
  17. // Defaults console values
  18.  
  19. //-----------------------------------------------------------------------------
  20. // Package overrides to initialize the mod.
  21. package control {
  22.  
  23. function OnStart()
  24. //------------------------------------------------------------------------
  25. // Called by root main when package is loaded
  26. //------------------------------------------------------------------------
  27. {
  28.    Parent::OnStart();
  29.    Echo("\n++++++++++++ Initializing control module ++++++++++++");
  30.  
  31.    // The following scripts contain the preparation code for
  32.    // both the client and server code. A client can also host
  33.    // games, so they need to be able to act as servers if the
  34.    // user wants to host a game. That means we always prepare
  35.    // to be a server at anytime, unless we are launched as a
  36.    // dedicated server.
  37.    Exec("./client/initialize.cs");
  38.    Exec("./server/initialize.cs");
  39.    InitializeServer(); // Prepare the server-specific aspects
  40.    InitializeClient(); // Prepare the client-specific aspects
  41. }
  42.  
  43. function OnExit()
  44. //------------------------------------------------------------------------
  45. // Called by root main when package is unloaded
  46. //------------------------------------------------------------------------
  47. {
  48.  
  49.    Parent::onExit();
  50. }
  51.  
  52. }; // Client package
  53.  
  54. ActivatePackage(control); // Tell TGE to make the client package active
  55.